import {Pipe, PipeTransform} from "@angular/core";
/**
 * Created by Administrator on 2017/3/28.
 */
@Pipe({name: 'booleanType'})
export class BooleanTypePipe implements PipeTransform {
    transform(value: any,index:number): string {
        let result: string = "-";
        for(let type of this.types[index]){
            if(type.value==value){
                return type.name;
            }
        }
        return "未知"
    }


    types: any =[
        [
            {name: "是", value: true},
            {name: "否", value: false},
        ],
        [
            {name: "通过", value: true},
            {name: "不通过", value: false},
        ],
        [
            {name: "合理", value: true},
            {name: "不合理", value: false},
        ]
    ]


    getTypes(index:number): any {
        return this.types[index]
    }
}